import React, { Component } from 'react'

export default class RouteHook extends Component {

  componentDidMount() {
    let { beforeEach, match, meta,history } = this.props;
    var formHistory = localStorage.getItem("FORM_HISTOSY") ? JSON.parse(localStorage.getItem("FORM_HISTOSY")):null;
    beforeEach && beforeEach(
      {
        match, 
        meta
      },
      formHistory,
      history
    )
    localStorage.setItem("FORM_HISTOSY",JSON.stringify({
      match, meta
    }))
  }
  render() {
    let { RouteCom } = this.props
    return (
      <RouteCom {...this.props}></RouteCom>
    )
  }
}
